import numpy as np


class Perceptron:
    """No learning rate and the bias changes over iterations."""

    def __init__(self, num_iterations, bias, inputs, weights):
        self.num_iterations = num_iterations
        self.bias = bias
        self.inputs = np.array(inputs)
        self.weights = np.array(weights)

    def step_function(self, x):
        return 1 if x >= 0 else 0

    def predict(self, input_data):
        linear_output = np.dot(input_data, self.weights) + self.bias
        return self.step_function(linear_output)

    def train(self, labels, verbose=False):
        for iteration in range(self.num_iterations):
            for input_data, label in zip(self.inputs, labels):
                prediction = self.predict(input_data)
                error = label - prediction
                self.weights += error * input_data
                self.bias += error
                if verbose:
                    print(
                        f"Iteration {iteration+1}/{self.num_iterations} - Weights: {self.weights} Bias: {self.bias}"
                    )
